home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Turnbull China Bikeride
/
Turnbull China Bikeride - Disc 2.iso
/
BARNET
/
COMPILER
/
SATHER
/
!Sather
/
Library
/
Base
/
test
/
sa
/
char
< prev
next >
Wrap
Text File
|
1996-04-09
|
4KB
|
95 lines
---------------------------> Sather 1.1 source file <--------------------------
-- test_char.sa:
-- Author: Benedict A. Gomes <gomes@samosa.ICSI.Berkeley.EDU>
-- Copyright (C) 1995, International Computer Science Institute
-- $Id: char_test.sa,v 1.2 1996/04/09 10:04:15 borisv Exp $
--
-- COPYRIGHT NOTICE: This code is provided WITHOUT ANY WARRANTY
-- and is subject to the terms of the SATHER LIBRARY GENERAL PUBLIC
-- LICENSE contained in the file: Sather/Doc/License of the
-- Sather distribution. The license is also available from ICSI,
-- 1947 Center St., Suite 600, Berkeley CA 94704, USA.
-------------------------------------------------------------------
class TEST_CHAR is
-- Test of `CHAR'.
include TEST;
main is
-- Test `CHAR'.
class_name("CHAR");
-- is_alpha
test("' '.is_alpha", ' '.is_alpha.str, "false");
test("'.'.is_alpha", '.'.is_alpha.str, "false");
test("'1'.is_alpha", '1'.is_alpha.str, "false");
test("'a'.is_alpha", 'a'.is_alpha.str, "true");
test("'A'.is_alpha", 'A'.is_alpha.str, "true");
test("3.char.is_alpha", 3.char.is_alpha.str, "false");
-- is_upper
test("' '.is_upper", ' '.is_upper.str, "false");
test("'.'.is_upper", '.'.is_upper.str, "false");
test("'1'.is_upper", '1'.is_upper.str, "false");
test("'a'.is_upper", 'a'.is_upper.str, "false");
test("'A'.is_upper", 'A'.is_upper.str, "true");
test("3.char.is_upper", 3.char.is_upper.str, "false");
-- is_lower
test("' '.is_lower", ' '.is_lower.str, "false");
test("'.'.is_lower", '.'.is_lower.str, "false");
test("'1'.is_lower", '1'.is_lower.str, "false");
test("'a'.is_lower", 'a'.is_lower.str, "true");
test("'A'.is_lower", 'A'.is_lower.str, "false");
test("3.char.is_lower", 3.char.is_lower.str, "false");
-- is_digit
test("' '.is_digit", ' '.is_digit.str, "false");
test("'.'.is_digit", '.'.is_digit.str, "false");
test("'1'.is_digit", '1'.is_digit.str, "true");
test("'a'.is_digit", 'a'.is_digit.str, "false");
test("'A'.is_digit", 'A'.is_digit.str, "false");
test("3.char.is_digit", 3.char.is_digit.str, "false");
-- is_alphanum
test("' '.is_alphanum", ' '.is_alphanum.str, "false");
test("'.'.is_alphanum", '.'.is_alphanum.str, "false");
test("'1'.is_alphanum", '1'.is_alphanum.str, "true");
test("'a'.is_alphanum", 'a'.is_alphanum.str, "true");
test("'A'.is_alphanum", 'A'.is_alphanum.str, "true");
test("3.char.is_alphanum", 3.char.is_alphanum.str, "false");
-- is_space
test("' '.is_space", ' '.is_space.str, "true");
test("'.'.is_space", '.'.is_space.str, "false");
test("'1'.is_space", '1'.is_space.str, "false");
test("'a'.is_space", 'a'.is_space.str, "false");
test("'A'.is_space", 'A'.is_space.str, "false");
test("3.char.is_space", 3.char.is_space.str, "false");
-- is_print
test("' '.is_print", ' '.is_print.str, "true");
test("'.'.is_print", '.'.is_print.str, "true");
test("'1'.is_print", '1'.is_print.str, "true");
test("'a'.is_print", 'a'.is_print.str, "true");
test("'A'.is_print", 'A'.is_print.str, "true");
test("3.char.is_print", 3.char.is_print.str, "false");
-- is_punct
test("' '.is_punct", ' '.is_punct.str, "false");
test("'.'.is_punct", '.'.is_punct.str, "true");
test("'1'.is_punct", '1'.is_punct.str, "false");
test("'a'.is_punct", 'a'.is_punct.str, "false");
test("'A'.is_punct", 'A'.is_punct.str, "false");
test("3.char.is_punct", 3.char.is_punct.str, "false");
-- is_control
test("' '.is_control", ' '.is_control.str, "false");
test("'.'.is_control", '.'.is_control.str, "false");
test("'1'.is_control", '1'.is_control.str, "false");
test("'a'.is_control", 'a'.is_control.str, "false");
test("'A'.is_control", 'A'.is_control.str, "false");
test("3.char.is_control", 3.char.is_control.str, "true");
-- other
test("'a'.int", 'a'.int.str, "97");
test("'a'.str", 'a'.str, "a");
test("'a'.upper", 'a'.upper.str, "A");
test("'A'.lower", 'A'.lower.str, "a");
finish;
end; -- char_test
end;
-------------------------------------------------------------------